
/* int % int */
#ifndef __mc68010__
ENTRY(__modsi3)
	movel	4(%sp),%d1
#ifdef __mcoldfire__
	remsl	8(%sp),%d0:%d1
	divsl	8(%sp),%d1
#else
	divsll	8(%sp),%d0:%d1
#endif
	rts
END(__modsi3)
#else
ENTRY(__modsi3)
| NB: this requires that __udivsi3 preserve %a0 and return
| the modulus in %d1:
	movel	(%sp)+, %a0	| pop return address
	movel	4(%sp), %d1	| load the divisor
	bpl	1f
	negl	4(%sp)		| store abs(divisor)
1:	movel	(%sp), %d0	| load the dividend
	pea	(.Lret,%pc)	| push our return address
	bpl	2f
	negl	4(%sp)		| store abs(dividend)
	subql	#2, (%sp)	| adjust return address
2:	jmp	_C_LABEL(__udivsi3)
	negl	%d1		| negate modulus
.Lret:	movl	%d1, %d0	| move modulus into %d0
	jmp	(%a0)
END(__modsi3)
#endif /* __mc68010__ */
